package command;

import machine.AgriculturalMachine;

public class OperateAttachmentCommand implements Command{
    private final AgriculturalMachine machine;
    private final String operation;

    public OperateAttachmentCommand(AgriculturalMachine machine, String operation) {
        this.machine = machine;
        this.operation = operation;
    }

    @Override
    public void execute() {
        System.out.println("执行命令: " + operation + " " + machine.getMachineId());
        machine.operateAttachment(operation);
    }

    @Override
    public void undo() {
        System.out.println("撤销命令: 停止 " + operation + " " + machine.getMachineId());
        machine.stopAttachment();
    }

    @Override
    public String getDescription() {
        return operation + " " + machine.getMachineId();
    }
}
